<template>
    <div class="page">
        <yd-cell-group>
            <yd-cell-item>
                <span slot="left">
                    用户名：
                </span>
                <yd-input max="20" placeholder="请输入用户名" required="" slot="right" v-model="username">
                </yd-input>
            </yd-cell-item>
            <yd-cell-item>
                <span slot="left">
                    密码：
                </span>
                <yd-input placeholder="请输入密码" slot="right" type="password" v-model="passwd">
                </yd-input>
            </yd-cell-item>
        </yd-cell-group>

        <yd-button-group>
            <yd-button class='loginBtn' size='large' @click.native="loginBtnClickAction">登录</yd-button>
            <button class="regBtn" @click='regBtnClick'>注册</button>
        </yd-button-group>
    </div>
</template>
<script>
	import vm from '@/viewmodel/login_viewmodel';
    export default {

  name: 'login',

  data () {
    return {
    	username:'',
    	passwd:''
    }
  },
  methods:{
  	loginBtnClickAction(){
      this.$router.push({name:'home'});
      return;


  		let self = this;
  		vm.net_login(this.username,this.passwd).then(data=>{
	  		 self.$dialog.toast({
                    mes: '保存成功',
                    timeout: 1500,
                    icon: 'success',
                    callback: () => {
                        this.$dialog.alert({mes: '给你一次重来的机会！'});
                    }
                });
  		});
  	},
    regBtnClick(){
      this.$router.push({name:'reg'});
    }
  }
}
</script>
<style lang="css" scoped="">
.page{
  position: relative;
	height: 100%;
	background-color: #fff;
	padding-top: 200px;
}
.loginBtn {
  background: linear-gradient(left,#55C5B9, #63DA90);
}
.regBtn {
  border: none;
  position: absolute;
  bottom: 40px;
  font-size: 14px;
  left: 0;
  width: 100%;
}
</style>